package mysqldb

import (
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

var (
	MysqlDb  *gorm.DB
	MysqlErr error
)

func ConnectDb() {
	println("connect mysql db")
	dsn := "root:test_1388@tcp(127.0.0.1:3306)/shop_db?charset=utf8mb4&parseTime=True&loc=Local"

	MysqlDb, MysqlErr = gorm.Open(mysql.Open(dsn), &gorm.Config{})
	if MysqlErr != nil {
		println("connect mysql db failed")
		return
	}
	println("connect mysql db success")
}
